﻿using Entidades;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AccesoDatos
{
    public class ADParametro
    {
        Database oDatabase = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings["conexionBD"]);

        public List<ENParametro> ParametroListar(string dominio_id)
        {
            DbCommand oDbCommand = oDatabase.GetStoredProcCommand("usp_Parametro_PorDominio");
            oDatabase.AddInParameter(oDbCommand, "descripcion", DbType.String, dominio_id);
            List<ENParametro> lista = new List<ENParametro>();

            using (IDataReader reader = oDatabase.ExecuteReader(oDbCommand))
            {
                while (reader.Read())
                    lista.Add(new ENParametro(reader));
            }
            return lista;
        }

        //public List<ENParametro> ParametroListarPag(
        //  int pagina, int cantRegxPag)
        //{
        //    DbCommand odbcommand = oDatabase.GetStoredProcCommand("USP_SEL_CLIENTES_PAG");
        //    oDatabase.AddInParameter(odbcommand, "pagina", DbType.Int32, pagina);
        //    oDatabase.AddInParameter(odbcommand, "cantRegxPag", DbType.Int32, cantRegxPag);
        //    List<ENCliente> lista = new List<ENCliente>();
        //    using (IDataReader reader = oDatabase.ExecuteReader(odbcommand))
        //    {
        //        while (reader.Read())
        //            lista.Add(new ENCliente(reader, 1));
        //    }
        //    return lista;
        //}

    }
}
